<%@ taglib prefix="spring-tags" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="spring-form" uri="http://www.springframework.org/tags/form"%>
<%@ page
    import="java.util.Iterator"
    import="org.jiscinvolve.astrodabis.mallow.model.api.Tag"
    import="org.jiscinvolve.astrodabis.mallow.model.api.Account"

    import="org.jiscinvolve.astrodabis.mallow.model.api.JoinTag"
    import="org.jiscinvolve.astrodabis.mallow.model.api.JoinTagFactory"

    import="org.jiscinvolve.astrodabis.mallow.control.ViewData"
    import="org.jiscinvolve.astrodabis.mallow.control.joins.SimpleJoinData"

    session="true"
%>
<%
SimpleJoinData data = (SimpleJoinData) request.getAttribute(
    ViewData.VIEW_DATA
    ) ;
Account actor = data.actor();
Account user  = data.user();
%>
<html>
    <head>
	    <title>AstroDAbis annotation upload</title>
        <link href='/astrodabis/css/page.css' rel='stylesheet' type='text/css'/>
    </head>
    <body>
        <%@ include file="/jsp/header.jsp" %>
        <div class='body'>
            <div class='left'>
                <%@ include file="/jsp/menu.jsp" %>
            </div>
            <div class='right'>
            </div>
            <div class='content'>
		        <h2>AstroDAbis annotation upload</h2>
                <table>
                <%
                final JoinTagFactory factory = data.factory();
                final JspWriter myout = out ;
                data.iterator().iterate(
                    new Iterator<JoinTag>()
                        {
                        public boolean hasNext()
                            {
                            return factory.hasNext();
                            }
                        public JoinTag next()
                            {
                            try {
                                JoinTag jtag = factory.next();
                                myout.write("<tr>");

                                    myout.write("<td>");
                                    myout.write(
                                        jtag.join().left().table().name()
                                        );
                                    myout.write(":");
                                    myout.write(
                                        jtag.join().left().key()
                                        );
                                    myout.write("</td>");

                                    myout.write("<td>");
                                    myout.write(
                                        jtag.join().right().table().name()
                                        );
                                    myout.write(":");
                                    myout.write(
                                        jtag.join().right().key()
                                        );
                                    myout.write("</td>");

                                    myout.write("<td>");
                                    myout.write(
                                        jtag.tag().name()
                                        );
                                    myout.write("</td>");

                                    myout.write("<td>");
                                    myout.write(
                                        jtag.value().toString()
                                        );
                                    myout.write("</td>");

                                myout.write("</tr>");

                                return jtag ;
                                }
                            catch (Exception ouch)
                                {
                                throw new RuntimeException(ouch); 
                                }
                            }
                        public void remove()
                            {
                            }
                        }
                    );
                %>
                </table>
		        <p>
		            Thank you ...
		        </p>
            </div>
        </div>
        <%@ include file="/jsp/footer.jsp" %>
    </body>
</html>

